<?php
/**
 * @author GhostWei
 * @date Oct 27, 2012
 */
class oauth_request_facebook extends oauth_api_request {
	
	public function init() {
		$this->_name = 'facebook';
		$this->_params['access_token'] = $this->getOauth()->getAccessToken();
		$this->_url[parent::USER_LINE] = 'https://graph.facebook.com/%u%';
		$this->_url[parent::USER_TWEET_LIST] = 'https://graph.facebook.com/%u%/feed';
		$this->_url[parent::PUBLIC_TWEET_LIST] = 'https://open.t.qq.com/api/statuses/public_timeline';
		$this->_url[parent::TWEET_LINE] = 'https://open.t.qq.com/api/t/show';
		$this->_url[parent::HOT_TOPIC_LIST] = 'https://graph.facebook.com/search?q=all';
		$this->_url[parent::TOPIC_TWEET_LIST] = 'https://graph.facebook.com/search';
		
		$this->_flips = array('keyword' => 'q');
	}

	/**
	 * @return oauth_api_response
	 */
	public function fetch($action, array $params) {
		if(isset($params['uid'])) {
			$this->_url[$action] = str_replace('%u%', $params['uid'], $this->_url[$action]);
		}
		if($action == parent::TOPIC_TWEET_LIST) {
			$this->_params['type'] = 'post';
		}
		if($action == parent::HOT_TOPIC_LIST) {
			$this->_params['type'] = 'page';
		}
		return parent::fetch($action, $params);
	}
	
	
	
}
